<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
if (!defined('THINK_PATH')){
	exit('Access Denied');
}
class RssAction extends BpAction{
	public function  index(){
		global $_SGLOBAL;
		//继承初始网站系统相关信息
		$pgsys = $this->PublicPgsys;
		//网站系统相关设置在当前控制器私有设置
		$pgsys['sys_set']['set_footer_tools'] = 1; //网站页脚 ”常用工具“ 显示
		//定义左侧分类
		$LeftCate = getLeftCategory();
		//定义右侧专题列表
		$RightZT = getRightZT();
		//推荐site
		$DbCommendStie = D("NbSite");
		$CommendSite = $DbCommendStie->getCommendSite('flag = 1 and country_id = 0 and commend = 1' , 'f7 desc' , 35);
		//新闻
		$DbNews = D("News");
		$NewsList = $DbNews->getNewsList('' , 'news_id desc' , 22);
		//模板输出
		$this->assign('sys_set' , $pgsys['sys_set']); //网站系统相关设置当前私有设置模板输出
		$this->assign('leftcate' , $LeftCate);
		$this->assign('rightzt' , $RightZT);
		$this->assign('commendsite' , $CommendSite);
		$this->assign('newslist' , $NewsList);
		$this->display('index');
	}

	//newsrss
	public function newsrss()
	{
		C ( 'SHOW_PAGE_TRACE', false );
		$DbNews = M("News");
		$arrNewsList = $DbNews->order("news_id desc")->limit(10)->select();
		import("@.ORG.Input");//导入Input类
		foreach($arrNewsList as $key=>$value)
		{
			$arrNewsList[$key]['news_content'] = Input::deleteHtmlTags($value['news_content']);
			$arrNewsList[$key]['news_content'] = msubstr($arrNewsList[$key]['news_content'], 0, 300, 'utf-8', FALSE);
		}
		$this->assign('newsrss',$arrNewsList);
		$this->display('newsrss');
	}

	//政策法规
	public function zhengcerss()
	{
		C ( 'SHOW_PAGE_TRACE', false );
		$DbNews = M("News");
		$arrNewsList = $DbNews->where("class = 3")->order("news_id desc")->limit(10)->select();
		import("@.ORG.Input");//导入Input类
		foreach($arrNewsList as $key=>$value)
		{
			$arrNewsList[$key]['news_content'] = Input::deleteHtmlTags($value['news_content']);
			$arrNewsList[$key]['news_content'] = msubstr($arrNewsList[$key]['news_content'], 0, 300, 'utf-8', FALSE);
		}
		$sTop = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" . chr(10);
		$this->assign('newsrss',$arrNewsList);
		$this->display('zhengcerss');
	}

	//网评rss
	public function wangpingrss()
	{
		C ( 'SHOW_PAGE_TRACE', false ); //关闭调试信息
		$DbNews = M("NbSite");
		$arrNewsList = $DbNews->where("flag = 1")->order("site_id desc")->limit(10)->select();
		import("@.ORG.Input");//导入Input类
		foreach($arrNewsList as $key=>$value)
		{
			$arrNewsList[$key]['site_link'] = urldecode($value['site_link']);
		}
		$sTop = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" . chr(10);
		$this->assign('newsrss',$arrNewsList);
		$this->display('wangpingrss');
	}

	//blacklist rss
	public function blacklistrss()
	{
		C ( 'SHOW_PAGE_TRACE', false );
		$DbNews = M("NbSite");
		$arrNewsList = $DbNews->where("flag = 1 and hei = 1")->order("site_id desc")->limit(10)->select();
		import("@.ORG.Input");//导入Input类
		foreach($arrNewsList as $key=>$value)
		{
			$arrNewsList[$key]['site_link'] = urldecode($value['site_link']);
		}
		$sTop = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" . chr(10);
		$this->assign('newsrss',$arrNewsList);
		$this->display('blacklistrss');
	}
	//网购投诉 rss
	public function tousurss(){
		C ( 'SHOW_PAGE_TRACE', false );
		$DbNews = M("NbTousu");
		$arrNewsList = $DbNews->where("flag = 1")->order("tousu_id desc")->limit(10)->select();
		import("@.ORG.Input");//导入Input类
		foreach($arrNewsList as $key=>$value)
		{
			$arrNewsList[$key]['tousu_content'] = Input::deleteHtmlTags($value['tousu_content']);
			$arrNewsList[$key]['tousu_content'] = msubstr($arrNewsList[$key]['tousu_content'], 0, 300, 'utf-8', FALSE);
		}
		$sTop = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" . chr(10);
		$this->assign('newsrss',$arrNewsList);
		$this->display('tousurss');
	}
}
?>
